<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Registration</title>
    </h:head>
    <h:body>
       
        <br/><br/><br/><br/>
        <h:form id="registrationform">
            <div align="center" >
            <p:panel header="Registration Form" style="width:700px; height:310px; 
                     background-color: aliceblue">
                <h:panelGrid columns="3" id="regGrid" cellspacing="5" style="font-family:calibri;font-size:20px;color:#000066;">
                    <h:outputLabel for="username" style="font-weight:bold;margin-left: 30px">Username</h:outputLabel>
                    <p:inputText id="username" value="#{registrationBean.user.username}">
                        <p:ajax update="usernamemsg"/>
                    </p:inputText>
                    <p:message id="usernamemsg" for="username" />
                    
                    <h:outputLabel for="email" style="font-weight:bold;margin-left: 30px">Email</h:outputLabel>
                    <p:inputText id="email" value="#{registrationBean.user.email}" >
                        <p:ajax update="emailmsg"/>
                    </p:inputText>
                    <p:message id="emailmsg" for="email" />
                    
                    <h:outputLabel for="password" style="font-weight:bold;margin-left: 30px">Password</h:outputLabel>
                    <p:password id="password" value="#{registrationBean.user.password}"
                                feedback="true" match="pwd2" label="Password"/>
                    <p:message for="password" />

                    <h:outputLabel for="pwd2" style="font-weight:bold;margin-left: 30px">Confirm password &nbsp;&nbsp;&nbsp;</h:outputLabel>
                    <p:password id="pwd2" label="Confirm Password"/>
                </h:panelGrid>
                <br/>                
                <div align="center">
                    <h:panelGrid columns="2" cellpadding="10">
                        <p:button id="back" value="Back" outcome="login" style="font-family:calibri;color:#000066;width:140px;height:40px;font-size:20px" />
                        <p:commandButton id="submit" value="Register" update="@all" action="#{registrationBean.register()}"
                                         style="font-family:calibri;color:#000066;width:140px;height:40px;font-size:20px"/>
                    </h:panelGrid>
                </div>
            </p:panel>
            </div>
            <br/>
           <div align="center"> <h:messages layout="table" style="color: red"/> </div>
        </h:form>
    </h:body>
</html>

